package com.ws.ssmzongjie3.mapper;

import com.ws.ssmzongjie3.bean.Orders;
import com.ws.ssmzongjie3.bean.Route;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface RouteMapper {


    public void insertRoute(Route route);

    @Delete("DELETE FROM route WHERE route_id = #{route_id}")
    public void deleteRoute(Route route);

    @Select("SELECT * FROM route WHERE route_id = #{route_id}")
    public Route getRouteById(Route route);


    public void updateRoute(Route route);

    public List<Route> listRoute(Route route);

    @Update("UPDATE route SET is_delete = 1 WHERE route_id = #{route_id}")
    public void updateRouteDelete(Route route);


//    @Select("SELECT r.*, b.business_name, c.column_name FROM route r " +
//            "LEFT JOIN business b ON r.business_id = b.business_id " +
//            "LEFT JOIN column c ON r.column_id = c.column_id " +
//            "WHERE r.is_delete = 0")
    public List<Route> listRouteWithBusinessAndColumn(Route route);

    public List<Route> listRouteWithAttachments(Route route);
    public List<Route> collectionDesc(Route route);

/**
 * 查询线路及其点赞信息
 *
 * @param route       线路对象
 * @param userId      用户ID
 * @param isCollected 是否已点赞
 * @return 线路列表
 */
List<Route> listRouteWithLikes(@Param("route") Route route, @Param("userId") Integer userId, @Param("isCollected") Boolean isCollected);

/**
 * 查询线路及其收藏信息
 *
 * @param route       线路对象
 * @param userId      用户ID
 * @param isCollected 是否已收藏
 * @return 线路列表
 */
List<Route> listRouteWithCollections(@Param("route") Route route, @Param("userId") Integer userId, @Param("isCollected") Boolean isCollected);

}
